package com.wwh.Thread;
//创建多线程的方式一:继承Thread类
class PrintThread extends Thread{
	//重写Thread的run方法
	public void run(){
		//子线程执行的代码(功能)
		for(int i = 0;i <= 100;i++){
			if(i % 2 == 0){
				System.out.println(Thread.currentThread().getName() + ":" + i);
			}
		}
	}
	
	public PrintThread(String name){
		super(name);
	}
}

public class SubThread4 {
	public static void main(String[] args) {
		//创建线程的实例
		PrintThread pt1 = new PrintThread("线程1");
		PrintThread pt2 = new PrintThread("线程2");
		//设置优先级
		pt1.setPriority(Thread.MAX_PRIORITY);//10
		pt2.setPriority(Thread.MIN_PRIORITY);//1
		//启动线程
		pt1.start();
		pt2.start();
	}
}
